package com.wf.controller;


import com.wf.api.auth.UserService;
import com.wf.domain.LoanTargetsES;
import com.wf.domain.SysUser;
import com.wf.dto.LoanPageDTO;
import com.wf.service.LoanTargetsService;
import com.wf.vo.LoanListVO;
import com.wf.web.base.BaseController;
import com.wf.web.domain.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 标的模块
 * @author mpk
 * @since 2024/10/10 19:50:04
 */
@RestController
@RequestMapping("/loan")
public class LoanController extends BaseController {

    @Autowired
    private LoanTargetsService loanTargetsService;

    @Autowired
    private UserService userService;

    /**
     * 标的申请
     * @return
     */
    @PostMapping("/pending")

    public Result pendingLoan(@RequestBody LoanTargetsES loanTargets)
    {
        loanTargetsService.pending(loanTargets);
        return success();
    }
    /**
     * 标的审核
     * @return
     */
    @PutMapping("/audit")
    public Result auditLoan()
    {
        SysUser sysUser = new SysUser();
        sysUser.setId("1");
        sysUser.setUserId("88888888");
        sysUser.setRealName("admin");
        sysUser.setStatus(0);
        return userService.updateUser();
    }


    /**
     * 分页查询借款产品
     * @return
     */
    @PostMapping("/page")
    public Result page(@RequestBody LoanPageDTO loanPageDTO)
    {
        List<LoanListVO> list= loanTargetsService.pageList(loanPageDTO);
        return success();
    }


}
